package day1;

import java.util.Scanner;

public class Demo3 {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        String str=scanner.next();
        int n=str.length();
        char[]ret=new char[n];
        if(str!=null){
            ret[0]=str.charAt(0);
        }
        int left=0;
        for (int i = 1; i <n ; i++) {
            if(left<0){
                ret[++left]=str.charAt(i);
                i++;
            }
            if(str.charAt(i)==ret[left]){
                left--;
            }else {
                ret[++left]=str.charAt(i);
            }
        }
        for (int i = 0; i <=left ; i++) {
            System.out.print(ret[i]);
        }
        if (left==-1) System.out.println(0);

    }
}
